package com.example.ccj.u.server;

import com.alibaba.fastjson.JSON;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 服务器返回数据
 */
public class Result implements Serializable {
    public Date getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Date timestamp) {
        this.timestamp = timestamp;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getDataType() {
        return dataType;
    }

    public void setDataType(String dataType) {
        this.dataType = dataType;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public boolean isLocalData() {
        return localData;
    }

    public void setLocalData(boolean localData) {
        this.localData = localData;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public String getCacheName() {
        return cacheName;
    }

    public void setCacheName(String cacheName) {
        this.cacheName = cacheName;
    }


    private Date timestamp = new Date();
    private int status = 0 ;//返回信息码
    private String message = "";//返回时附带的信息
    private String error = "";//返回错误信息说明
    private String data = "";//返回的数据
    private String dataType = "";//返回的数据类型
    private boolean success = true; //返回数据是否需要更新
    private boolean localData = false; //是否使用本地数据加载
    private int version;//服务器数据版本
    private String cacheName; //缓存标识

    public List<Object> getDataList() {
        return dataList;
    }

    public void setDataList(List<Object> dataList) {
        this.dataList = dataList;
    }

    private List<Object> dataList;

    @Override
    public String toString() {
        return "ResResultBean{" +
                "timestamp=" + timestamp +
                ", status=" + status +
                ", message='" + message + '\'' +
                ", error='" + error + '\'' +
                ", data='" + data + '\'' +
                ", dataType='" + dataType + '\'' +
                ", success=" + success +
                ", localData=" + localData +
                ", version=" + version +
                ", cacheName='" + cacheName + '\'' +
                ", dataList=" + JSON.toJSONString(dataList) +
                '}';
    }
}
